<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	template="../../Template/TemplateAdmin.xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="title">	
		Trang #{themSanPhamBean.titleText} sản phẩm
  	</ui:define>

	<ui:define name="content">

		<h:outputStylesheet library="css" name="themsanpham.css" />
		<!-- Content -->
		<div id="MainPanel" align="left">

			<div class="ContentPart">
				<h1 class="ContentPartTitle" align="center">TRANG
					#{themSanPhamBean.titleText.toUpperCase()} SẢN PHẨM</h1>
			</div>
			<div class="ContentPart">
				<h3 class="ContentPartHeader">THÔNG TIN SẢN PHẨM</h3>

				<div class="ContentPart">
					<div class="ContentPartContent">
						<h:messages id="messageNotification" />
					</div>
				</div>

				<div class="ContentPartContent">
					<div class="ins">Nhóm sản phẩm</div>
					<h:selectOneMenu name="cbbNhomSanPham" id="cbbNhomSanPham"
						class="combobox" value="#{themSanPhamBean.maNhomSanPham}">
						<f:selectItem itemLabel="Tất cả" itemValue="-1" />
						<f:selectItems value="#{headerBean.lstDanhMuc}" var="danhMuc"
							itemLabel="#{danhMuc.getTennhom()}"
							itemValue="#{danhMuc.getManhom()}" />
						<f:ajax listener="#{themSanPhamBean.changeNhomListener}"
							render="cbbLoaiSanPham" />
					</h:selectOneMenu>

					<br />
					<div class="ins">Loại sản phẩm</div>
					<h:selectOneMenu name="cbbLoaiSanPham" id="cbbLoaiSanPham"
						styleClass="combobox" value="#{themSanPhamBean.maLoaiSanPham}">
						<f:selectItems value="#{themSanPhamBean.lstLoaiSanPham}"
							var="danhMucLoaiSanPham"
							itemLabel="#{danhMucLoaiSanPham.getTenloaisanpham()}"
							itemValue="#{danhMucLoaiSanPham.getMaloaisanpham()}" />
					</h:selectOneMenu>
					<br />
					<div class="ins">Tên sản phẩm</div>
					<h:inputText class="txtField"
						value="#{themSanPhamBean.sanpham.tensanpham}" />
					<!-- <input class="txtField" type="text" /> -->
					<br />
					<div class="ins">Nhà sản xuất</div>
					<h:selectOneMenu name="cbbNhaSanXuat" id="cbbNhaSanXuat"
						styleClass="combobox" value="#{themSanPhamBean.maNhaSanXuat}">
						<f:selectItems value="#{themSanPhamBean.lstNhaSanXuat}"
							var="danhMucNSX" itemLabel="#{danhMucNSX.getTennhansanxuat()}"
							itemValue="#{danhMucNSX.getManhasanxuat()}" />
					</h:selectOneMenu>
					<br />
					<div class="ins">Giá bán (VNĐ)</div>
					<h:inputText class="txtField"
						value="#{themSanPhamBean.sanpham.giaban}" />
					<br />
					<div class="ins">Mô tả</div>

					<h:inputTextarea id="motasanpham" class="txtField"
						value="#{themSanPhamBean.sanpham.mota}" />
					<!-- <textarea id="motasanpham" class="txtField"></textarea> -->
					<br />
					<div class="ins">Xuất xử</div>
					<h:inputText class="txtField"
						value="#{themSanPhamBean.sanpham.xuatxu}" />
					<br />
					<div class="ins">Số lượng</div>
					<h:inputText class="txtField"
						value="#{themSanPhamBean.sanpham.soluongtrongkho}" />
					<br />
					<div class="ins">Hình ảnh</div>
					<t:inputFileUpload value="#{themSanPhamBean.uploadedFile}" />
					<!-- <input class="txtField fileInput" type="file" accept="image/png" />

					<h:inputText class="txtField"
						value="#{themSanPhamBean.sanpham.hinhanh}" /> -->
					<br />
					<h:commandButton class="buttonLink button flowToRight"
						action="#{themSanPhamBean.ThemSanPham()}" value="Thêm sản phẩm"
						rendered="#{not themSanPhamBean.isSuaThongTin}" />

					<h:commandButton class="buttonLink button flowToRight"
						action="#{themSanPhamBean.SuaSanPham()}" value="Sửa sản phẩm"
						rendered="#{themSanPhamBean.isSuaThongTin}" />
					<br /> <br />

				</div>
			</div>
		</div>
		<!-- Content -->
	</ui:define>
</ui:composition>